package com.xsg.sca.order.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author : xsg
 * @date : 2021/8/21
 */
@RestController
@RequestMapping("order")
public class OrderController {
    private final RestTemplate restTemplate;

    public OrderController(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    @GetMapping("add")
    public String addOrder() {
        String result = restTemplate.getForObject("http://localhost:8011/stock/reduce", String.class);
        return "hello world " + result;
    }

}
